Skip to content

fix: make README programmatic example importable (closes #250)#253

Merged
Scottcjn merged 1 commit into
Scottcjn:mainfrom
Vyacheslav-Tomashevskiy:fix/readme-programmatic-import-250
Jul 4, 2026
Merged

fix: make README programmatic example importable (closes #250)#253
Scottcjn merged 1 commit into
Scottcjn:mainfrom
Vyacheslav-Tomashevskiy:fix/readme-programmatic-import-250

Conversation

@Vyacheslav-Tomashevskiy

Copy link
Copy Markdown
Contributor

Summary

Fixes #250. The README quick-start "For Other MCP Clients" example was broken:

from rustchain_mcp import RustChainMCPServer
server = RustChainMCPServer(api_key="your-api-key")
server.run()

There is no RustChainMCPServer symbol and no api_key constructor. rustchain_mcp/__init__.py exported only __version__, and the server is a module-level FastMCP instance in rustchain_mcp/server.py (mcp = FastMCP(...)) — the same object the rustchain-mcp console script runs ([project.scripts]rustchain_mcp.server:mcp.run). So anyone following the documented Python example hit an ImportError.

Fix

  • rustchain_mcp/__init__.py: re-export the real server instance (from .server import mcp) so from rustchain_mcp import mcp works — this is the issue's suggested fix of "the package should export the documented symbol". __version__ is preserved and __all__ added.
  • README.md: replace the non-existent class example with the working API:
    from rustchain_mcp import mcp
    mcp.run()

Verification

Fresh venv, pip install fastmcp httpx, package installed from this branch:

  • Before: from rustchain_mcp import RustChainMCPServerImportError
  • After: from rustchain_mcp import mcp; mcp.run imports cleanly (type=FastMCP, name "RustChain + BoTTube + Beacon")
  • rustchain_mcp.__version__ still 0.4.0; __all__ == ['mcp', '__version__']
  • Console entry point unchanged (rustchain_mcp.server:mcp.run still resolvable and callable)

Docs-vs-code only; no tool behavior changed.

/claim #250

The README 'For Other MCP Clients' quick-start showed:

    from rustchain_mcp import RustChainMCPServer
    server = RustChainMCPServer(api_key="your-api-key")

but no RustChainMCPServer symbol (and no api_key constructor) exists —
rustchain_mcp/__init__.py exported only __version__, and the server is a
module-level FastMCP instance (rustchain_mcp/server.py -> mcp = FastMCP(...)),
which is what the rustchain-mcp console script already runs
([project.scripts] rustchain_mcp.server:mcp.run). Following the documented
example therefore raised ImportError.

Fix:
- Re-export the real server instance from the package (from .server import mcp),
  matching the issue's suggested fix of exporting the documented symbol.
- Update the README example to the working API: from rustchain_mcp import mcp; mcp.run().

Verified: 'from rustchain_mcp import mcp; mcp.run' now imports cleanly and the
console entry point is unchanged.

@jaxint jaxint left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review

Reviewer: @jaxint
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG

Summary

This PR addresses: fix: make README programmatic example importable

Code Review

Changes Reviewed:

  • Files: 2
  • Lines: +17/-3

Assessment: ✅ Approved

The changes follow the project's coding standards and address the issue described in the PR title. The implementation is clean and minimal.

Testing

  • Code changes are minimal and focused
  • No additional test coverage required for this fix

Recommendation

APPROVE - Ready for merge.


Review submitted via RustChain Bounty System
RTC bounty claim: 40 RTC per review (Bounty #73)

@Scottcjn Scottcjn merged commit b398f88 into Scottcjn:main Jul 4, 2026
6 checks passed
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

RTC Reward

This merged PR earned 5 RTC — sent to Vyacheslav-Tomashevskiy.

RustChain Bounty Program

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

README quick-start import path is broken: from rustchain_mcp import RustChainMCPServer fails

3 participants